<!-- 通用组件-选择器 -->
<template>
	<el-select 
		:popper-append-to-body="false"
		:value="value2"
		v-model="value2" 
		:placeholder="placeholder">
		<el-option label="" value=""></el-option>
		<el-option v-for="item in list" :key="item.id" :label="item.label" :value="item.id"></el-option>
	</el-select>
</template>
<script>
export default {
	props: ['value', 'placeholder', 'dataUrl'],
	data: function() {
		return {
			value2: this.value,
			list: []
		}
	},
	watch: {
		value: function(val) {
			this.value2 = val;
		},
		value2: function(val) {
			this.$emit('input', val);
		}
	},
	created: function() {
		var that = this;
		this.$axios(this.dataUrl).then(resp => {
			that.list = resp.data;
			that.value2 = that.value;
		});
	}
}
</script>

<style>

</style>
